package com.woniuxy.test_string;

/**
 * description: TestStringBulider <br>
 * date: 2022/2/1 10:28 下午 <br>
 * author: shesaifei <br>
 * version: 1.0 <br>
 */

/**
 * 测试StringBuilder、StringBuffer可变字符序列
 */
public class TestStringBulider {
    public static void main(String[] args) {
//        String str;
//        //StringBuilder线程不安全,效率高（一般使用它）:StringBuffer线程安全，效率低
//        StringBuilder sb = new StringBuilder("abcdefg");
//        System.out.println(Integer.toHexString(sb.hashCode()));
//        System.out.println(sb);
//
//        sb.setCharAt(2,'M');
//        System.out.println(Integer.toHexString(sb.hashCode()));
//        System.out.println(sb);
        strbuilder();
    }

    public static void strbuilder() {
        StringBuilder sb = new StringBuilder("");
        for (int i = 0; i <= 5000; i++) {
            sb.append(i);
        }
    }
}
